package com.kuzlak.cms.bean;

import lombok.Data;
import lombok.ToString;

import java.util.Date;

@ToString
@Data
public class LoginTime {

    private Date date;
    private int count;
    private String userName;
    private String ip;

    public boolean getFlag() {
        Date date1 = new Date();
        boolean flag = true;
        if (this.count > 5) {
            long time = date1.getTime() - this.date.getTime();
            long l = (time / 1000) / 60;
            if (l > 5) {
                flag = true;
                this.date = date1;
                this.count = 0;
            } else {
                flag = false;
            }
            //System.out.println("LoginTime:"+time);

        }

        return flag;
    }
}
